
package shell_sort;

import java.util.Random;

public class Shell_Sort {

    
   static void sort(int[] array){
   int i, j, k, n=0, m=5, b=array.length;
   int[] d = { 1, 4, 10, 23, 57};
   while (--m >= 0){
      k = d[m];
      for (i=k; i<b; i++){
         j=i;
         n=array[i];
         while ((j >= k) && (array[j-k] > n)){  
              array[j]=array[j-k];
              j =  j-k;
         }
         array[j] = n;
      }
   }
}
    public static void main(String[] args) {
        Random r=new Random();
        int[] z=new int[100];
        for(int i=0;i<100;i++){
            z[i]=Math.abs(r.nextInt())%1000;
        }
        sort(z);
    }
}
